<!--
// 
// LogContent.vue
// 海石后台管理
// 
// 2024/11/23.
//
-->
<template>
    <vxe-modal v-model="visible" :height="layout.modalHeight()" :min-width="layout.modalMinWidth(600)" :position="{top: '60px'}" :title="title" :width="layout.modalWidth(600)" destroy-on-close resize show-footer show-maximize @close="cancelClick">
        <div class="content">
            {{ state.options.logContent }}
        </div>
        <template #footer>
            <el-button :loading="isSubmitting" type="primary" @click="beforeSubmit">
                确定
            </el-button>
        </template>
    </vxe-modal>
</template>

<script setup>
import {ref, reactive, computed, onMounted} from "vue";
import {FormMixins} from "@/utils/FormMixins";
import * as api from "./api.js";

const {ELForm, visible, title, layout, isLoading, isSubmitting, state, setOptions, submitSuccess, cancelClick} = FormMixins();
const {$message} = window;

const Model = () => {
    return {
        id: null,
        name: null,
        sort: 0,
        remark: null,
    }
}

// 校验规则
const rules = computed(() => {
    return {
        name: [{required: true, message: "请输入名称"}],
    }
})

// 自定义校验规则
const customRules = {
    // pid: (rule, value, callback) => {
    //     if (state.model.type > 0) {
    //         if (!value) return callback(new Error("请选择上级菜单"));
    //     }
    //     return true;
    // },
};

// 表单显示
async function show(config) {
    setOptions(config);
    state.model = Model();
    state.model = {...state.model, ...state.options}
    // 初始化数据

}

// 校验表单
function beforeSubmit() {
    cancelClick()
}

onMounted(() => {
})
defineExpose({
    show
})
</script>


<style lang="scss" scoped>
.content {
    width: 100%;
}
</style>
